<?php
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));

defined('CACHE_PATH')
    || define('CACHE_PATH', realpath(dirname(__FILE__) . '/../cache'));

defined('APPLICATION_ENV')
    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));

// Настройка автозагрузчика
set_include_path(
    implode(
        PATH_SEPARATOR, 
        array(
            realpath(APPLICATION_PATH . '/models'),
            realpath(APPLICATION_PATH . '/../../library'),
            get_include_path()
        )));
require_once "Zend/Loader/Autoloader.php";
Zend_Loader::registerAutoload();

/** Zend_Application */
require_once 'Zend/Application.php';  
// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV, 
    APPLICATION_PATH . '/configs/application.ini'
);

if (isset($_SERVER["HTTP_X_HTTPS"]) && $_SERVER["HTTP_X_HTTPS"] == 'on'){
    $_SERVER["HTTPS"] = 'on';
}
$application->bootstrap()
            ->run();